
var global_index = 0;

function CaseData(tree, agent_index) {
    this.tree = tree;
    this.index = agent_index * 10000 + (global_index++);
    this.current = null;
    this.userdata = [];
}

CaseData.prototype.getTree = function () {
    return this.tree;
};

CaseData.prototype.getIndex = function () {
    return this.index;
};

CaseData.prototype.setNode = function (name) {
    this.current = tree.getNode(name);
};

CaseData.prototype.getNode = function (name) {
    return this.current.name;
};

CaseData.prototype.getUserData = function () {
    return this.userdata;
}

var casedatas = [];
var casecount = 0;

exports.create = function (tree, agent_index, count) {
    for(var i=0; i<count; i++) {
        casedatas.push(new CaseData(tree, agent_index));
    }
    casecount = count;
};

exports.get = function (index) {
    if(index>=casecount) return null;
    return casedatas[inde];
};
